package com.yjck.fm.system.action;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.List;

import net.sf.json.JSONArray;

import com.yjck.fm.common.BasicAction;
import com.yjck.fm.system.bean.Menu;
import com.yjck.fm.system.service.MenuService;

public class MenuAction extends BasicAction {
	private MenuService menuService;
	private String id;
	private InputStream inputStream;
	public String findMenu() throws Exception {
		List<Menu> menus = menuService.findMenuByParentId(this.id);
		JSONArray jsonArray = JSONArray.fromObject(menus);
		inputStream = new ByteArrayInputStream(jsonArray.toString().getBytes("UTF-8"));
		return SUCCESS;
	}
	public void setMenuService(MenuService menuService) {
		this.menuService = menuService;
	}
	public MenuService getMenuService() {
		return menuService;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getId() {
		return id;
	}
	public InputStream getInputStream() {
		return inputStream;
	}

}
